<?php
require_once '../inc/config.php';/* 得到session_start */
require_once '../inc/section.php';/*调用查找板块方法*/
require_once '../inc/book.php';/*调用查找书籍表*/
require_once '../inc/indexinc.php';/*调用查找书籍表*/
require_once 'header.php';	
?>	
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
		<title>阅读记-首页</title>
		<link rel="stylesheet" href="../css/index.css">
		<script type="text/javascript" src="../inc/jquery-2.1.1.min.js"></script>
		<script src="../script/index.js"></script>
	</head>
	<body>
	<div class="mainDIV">
		<div class="main">
			<div class="hotTopic">
				<div class="banner">
				  <div class="pic">
						<div class="left"> < </div>
						<ul>
							<li><a href="#"><img src="../image/index/01.jpg" ></a></li>
							<li><a href="#"><img src="../image/index/02.jpg" ></a></li>
							<li><a href="#"><img src="../image/index/03.jpg" ></a></li>
							<li><a href="#"><img src="../image/index/04.jpg" ></a></li>
							<li><a href="#"><img src="../image/index/05.jpg" ></a></li>
						</ul>
						<div class="right"> > </div>
					</div>
				</div><!--/banner  -->
			</div><!-- hotTopic -->
			<div class="subject">
				<div class="navSub" id="navSub">
					<div class="nav">
						<font id="font" ><span id="a1" ><a href="javascript:HideOrShowFont('a1')" onclick="change_div('rmzz')">热门作者</a></span>
						<span id="a2"><a href="javascript:HideOrShowFont('a2')"  onclick="change_div('rmsp')">热门书评</a></span>
						<span id="a3"><a href="javascript:HideOrShowFont('a3')"  onclick="change_div('kxyk')">开心一刻</a></span>
						<span id="a4" style="background-color: #537857"><a  href="javascript:HideOrShowFont('a4')"  onclick="change_div('rmtj');">热门推荐</a></span></font>
					</div>
	  <div class="boxleft" id="bl"> < </div><div class="boxright"  id="br"> > </div>
		</div>
				</div><!-- /navSub -->
				<div class="index">
	          <!-- 左侧导航条 -->
				<div class="section">
				<ul id="section" onMouseOver="change('sectiondown','block')" onMouseOut="change('sectiondown','none')">
					<li>
						<img src="../image/index/but.png" />
					</li>
					<li>
				<ul id="sectiondown">
						<?php 			
						$section=getSection();
						  $li="";
						  for($i=0;$i<count($section);$i++){
						  $sectioName=$section[$i]["sectionName"];
						  $sectionId=$section[$i]["sectionId"];
						  $li.=<<<li
                            <p id="wirte"></p>
                            <a href="section.php?sectionId=$sectionId&currentPage=1"><li>$sectioName</li></a>
                           
li;
                      }     
						  echo $li;
						?>  
						</ul>
					</li>
					</ul>
				</div>
<!-- 热门推荐 -->
		 	<div class="show">				
<!-- 动态分页显示书籍 -->
			   <div class="hotimage" >
			    <div class="box1"  id="rmtj"><!-- style="display:none" -->
				<ul>		
				<?php  
		          $book=getbook();
		          $li=""; 
                  for ($i=0; $i<8; $i++) {//循环输出    
                  $bookName=$book[$i]["bookName"];
                  $bookPic=$book[$i]["bookPic"];
                  $bookId=$book[$i]["bookId"];
                  $li.=<<<li
                  <div class="xiaobox1"><a href="book.php?bookId=$bookId&bookName=$bookName"><li><center><img src="../image/book/$bookPic" width="190px" height="230px";/>
                  <p><b style="font-size:22px;font-family:幼圆;">$bookName</b></p></center></li></a>
                  </div>
li;
          } echo $li;      //输出书本列表信息  ?>
               </ul>
				 <ul>		
				 <?php  
		          $book=getbook();
		          $li=""; 
                  for ($i=0;$i<17; $i++) {//循环输出
                   if($i>8){
                  $bookName=$book[$i]["bookName"];
                  $bookPic=$book[$i]["bookPic"];
                  $bookId=$book[$i]["bookId"];
                  $li.=<<<li
                  <div class="xiaobox1"><a href="book.php?bookId=$bookId&bookName=$bookName"><li><center><img src="../image/book/$bookPic" width="190px" height="230px";/>
                  <p><b style="font-size:22px;font-family:幼圆;">$bookName</b></p></center></li></a>
                  </div>
li;
          } }echo $li;      //输出书本列表信息  ?>
                  </ul>
				  <ul>		
				 <?php  
		          $book=getbook();
		          $li=""; 
                  for ($i=0;$i<25; $i++) {//循环输出
                   if($i>16){
                  $bookName=$book[$i]["bookName"];
                  $bookPic=$book[$i]["bookPic"];
                  $bookId=$book[$i]["bookId"];
                  $li.=<<<li
                  <div class="xiaobox1"><a href="book.php?bookId=$bookId&bookName=$bookName"><li><center><img src="../image/book/$bookPic" width="190px" height="230px";/>
                  <p><b style="font-size:22px;font-family:幼圆;font-color:black;">$bookName</b></p></center></li></a>
                  </div>
li;
          } }echo $li;      //输出书本列表信息  ?>
             
						</ul>
           </div><!-- hotimage -->
		</div><!-- box1 -->	
				</div><!-- contentSub -->
<!-- 热门书评 -->
				<div style="display:none" id="rmsp">
								<div class="rmsp">
				<ul>			
				<?php  
				$review=getreview();
		         // (reviewId,title,content,good,bookId,uId,labelId)
		          $li=""; 
		          for ($i=0; $i<count($review); $i++) {//循环输出    
		              $reviewId=$review[$i]["reviewId"];
		              $title=$review[$i]["title"];		          
		              $content=$review[$i]["content"];//var_dump($title); 
		              $uId=$review[$i]["uId"];//var_dump($uId); 
		              $userName=getusername($uId);//var_dump($userName);
		              $uName=$userName[0]["uname"]; //var_dump($uName);
		              $bookId=$review[$i]["bookId"];
		              $bName=getbookname($bookId);
		              $bookName=$bName[0]["bookName"];
		              $reviewtime=$review[$i]["reviewtime"];	              
                      $li.=<<<li
                        <ul>
                        <div class="rmspbox"> <p style="float:right;border-bottom:1px dashed #0b93d5;">$reviewtime<p> 
                        <br><font id="ff"><P>&nbsp;&nbsp;发表人：$uName</p>
                        <br><P>&nbsp;&nbsp;书名：$bookName</p><br>
                        <p>&nbsp;&nbsp;标题：$title</p> 
                        <br><P id="comment">&nbsp;&nbsp;书评：$content </p> 
                      
                             
                        </div>
                        </ul>
li;
          } echo $li;      //输出笑话列表信息  ?>		
               </ul>
</div>
</div>
<!-- 热门作者 -->
		
				<div style="display:none" id="rmzz">
				<div class="rmzz">
				<ul>				
				<?php 
				$curPage=$_GET['currentPage'];//设置当前是第几页
				$writerList=findListHot_writer($curPage);//分页取指定作者
				$writerNums=findCountHot_writer();//统计作者数
                $pageSize=$GLOBALS["cfg"]["server"]["page_size"];//页面容量
                $pages=ceil($writerNums/$pageSize);//计算总页数
//$book=findsectionId($sectionId);//取指定版块的书本列表		 
                $Hotwriter=getwriter();
		          $li=""; 
		          for ($i=0; $i<count($Hotwriter); $i++) {//循环输出    
		              $writerId=$Hotwriter["writerId"];
		              $writer=$Hotwriter[$i]["writer"];
		              $wrihead=$Hotwriter[$i]["wrihead"];//作者头像
		              $country=$Hotwriter[$i]["country"];//国家
		              $birthtime=$Hotwriter[$i]["birthtime"];//作者生日
		              $lifetime=$Hotwriter[$i]["lifetime"];//作者简介
                      $j=$i+1;
                  $li.=<<<li
                        <ul><div class="rmzzbox">
                        <div class="content"><img src="../image/wrihead/$wrihead" width="180px" height="225px";/></a>
                        </div>
                        <br><br><font id="ff"><p>&nbsp;&nbsp;作者：$writer</p>
                        <br><P>&nbsp;&nbsp;国家：$country </p>
                        <br><p>&nbsp;&nbsp;生日/生命：$birthtime</p></font><br>
                        <br><p id="life">&nbsp;&nbsp;作者简介：$lifetime</p> 
                        </div>           
                        </ul>
li;
          } echo $li;      //输出笑话列表信息  ?>		
               </ul>
</div>
</div>
<div>
<!-- 开心一刻 -->
<div style="display:none" id="kxyk">
				<ul>				
				<?php  
		          $joke=getjoke();
		          $li=""; 
		          for ($i=0; $i<count($joke); $i++) {//循环输出    
                  $jokeId=$joke[$i]["jokeId"];
                  $jokeContent=$joke[$i]["joke"];
                  $good=$joke[$i]["good"];
                  $j=$i+1;
                  $li.=<<<li
                  <div class="jokeContent"><p><b>&nbsp;&times;$j. $jokeContent&nbsp;&nbsp;&nbsp;</b></p></li></a>
                  </div>
li;
          } echo $li;      //输出笑话列表信息  ?>		
               </ul>
</div>
</div>
</div>
			</div><!-- /subject -->
		</div><!-- main -->

<?php require_once 'footer.php';?>
</body>
</html>